
const mongoose = require("mongoose");
const DB_URL = "mongodb://127.0.0.1:27017/ELFSACK?-u='JianYang'&-p=123123";

mongoose.connect(DB_URL,{useNewUrlParser:true},function(err,db){
    if(err) throw err;
})

mongoose.connection.on("connected",function(){
    console.log("连接成功数据库为"+DB_URL);
})
mongoose.connection.on("error",function(err){
    console.log("连接错误"+err);
})
mongoose.connection.on("disconnected",function(){
    console.log("Mongoose Connection disconnected");
})

module.exports =  mongoose
